package com.hdd.biz.home;

import com.hdd.biz.finance.service.PaymetService;
import com.hdd.biz.finance.service.WithdrawService;
import com.hdd.biz.home.entity.HomeReport;
import com.hdd.biz.member.service.MemberService;
import com.hdd.biz.painting.service.FavourService;
import com.hdd.biz.painting.service.PaintingWorksService;
import com.hdd.dto.SuperResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/WebHome")
@Api(value = "首页统计",tags = {"首页统计"})
@Slf4j
public class WebHomeController {


    @Autowired
    private MemberService memberService;
    @Autowired
    private PaintingWorksService paintingWorksService;
    @Autowired
    private FavourService favourService;
    @Autowired
    private PaymetService paymetService;
    @Autowired
    private WithdrawService withdrawService;


    @RequestMapping("/report")
    @ApiOperation(value = "首页统计" ,notes = "")
    public SuperResponse report(){
        SuperResponse response = new SuperResponse();
        HomeReport homeReport = new HomeReport();
        homeReport.setTodayRegisters(memberService.registerToday());
        homeReport.setTotalRegisters(memberService.registerTotals());
        homeReport.setYesterdayRegisters(memberService.yesterdayRegisters());
        homeReport.setWeekRegisters(memberService.weekRegisters());
        homeReport.setMonthRegisters(memberService.monthRegisters());



        homeReport.setTodayWorks(paintingWorksService.todayWorksWorks());
        homeReport.setTotalWorks(paintingWorksService.totalWorks());
        homeReport.setYesterdayWorks(paintingWorksService.yesterdayWorks());
        homeReport.setWeekWorks(paintingWorksService.weekWorks());
        homeReport.setMonthWorks(paintingWorksService.monthWorks());



        homeReport.setTotalFavour(favourService.totalFavour());
        homeReport.setTodayFavour(favourService.todayFavour());


        homeReport.setTodayPaymetAmount(paymetService.todayPaymetAmount());
        homeReport.setTotalPaymetAmount(paymetService.totalPaymetAmount());
        homeReport.setYesterdayPaymetAmount(paymetService.yesterdayPaymetAmount());
        homeReport.setWeekPaymetAmount(paymetService.weekPaymetAmount());
        homeReport.setMonthPaymetAmount(paymetService.monthPaymetAmount());



        homeReport.setTodayPaymet(paymetService.todayPaymet());
        homeReport.setTotalPaymet(paymetService.totalPaymet());
        homeReport.setYesterdayPaymet(paymetService.yesterdayPaymet());
        homeReport.setWeekPaymet(paymetService.weekPaymet());
        homeReport.setMonthPaymet(paymetService.monthPaymet());


        homeReport.setTodayWithdraw(withdrawService.todayWithdraw());
        homeReport.setTotalWithdraw(withdrawService.totalWithdraw());
        homeReport.setYesterdayWithdraw(withdrawService.yesterdayWithdraw());
        homeReport.setWeekWithdraw(withdrawService.weekWithdraw());
        homeReport.setMonthWithdraw(withdrawService.monthWithdraw());






        response.setItem(homeReport);
        return response;
    }



}
